/**
 * Copyright 2013 Netflix, Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.atom.zx.operators;

import java.util.concurrent.TimeUnit;

import com.atom.zx.Scheduler;
import com.atom.zx.Subscription;
import com.atom.zx.util.functions.Action0;
import com.atom.zx.util.functions.Func2;

class OperatorTester {

    private OperatorTester() {
    }

    public static class UnitTest {

        public static Scheduler forwardingScheduler(Scheduler underlying) {
            return new ForwardingScheduler(underlying);
        }

        public static class ForwardingScheduler extends Scheduler {
            private final Scheduler underlying;

            public ForwardingScheduler(Scheduler underlying) {
                this.underlying = underlying;
            }

            @Override
            public Subscription schedule(Action0 action) {
                return underlying.schedule(action);
            }

            @Override
            public <T> Subscription schedule(T state, Func2<Scheduler, T, Subscription> action) {
                return underlying.schedule(state, action);
            }

            @Override
            public Subscription schedule(Action0 action, long dueTime, TimeUnit unit) {
                return underlying.schedule(action, dueTime, unit);
            }

            @Override
            public <T> Subscription schedule(T state, Func2<Scheduler, T, Subscription> action, long dueTime, TimeUnit unit) {
                return underlying.schedule(state, action, dueTime, unit);
            }

            @Override
            public Subscription schedulePeriodically(Action0 action, long initialDelay, long period, TimeUnit unit) {
                return underlying.schedulePeriodically(action, initialDelay, period, unit);
            }

            @Override
            public <T> Subscription schedulePeriodically(T state, Func2<Scheduler, T, Subscription> action, long initialDelay, long period, TimeUnit unit) {
                return underlying.schedulePeriodically(state, action, initialDelay, period, unit);
            }

            @Override
            public long now() {
                return underlying.now();
            }
        }
    }
}